﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SimplePMT.Data;


namespace SimplePMT.Components
{
    public class BasePage : System.Web.UI.Page
    {
        private HttpContext context = HttpContext.Current;
        public bool ReadOnly = false;
        public bool AdminAccess = false;
        public void ValidateSession()
        {
            if (context.Session["MemberID"] == null)
            {
                context.Response.Redirect("Login.aspx?ReturnUrl=" + context.Server.UrlEncode(context.Request.Path + "?" + context.Request.QueryString));
            }
            else
            {
                Member member = Member.Find(Convert.ToInt32(Session["MemberID"]));
                ReadOnly = member.ReadOnly;
                AdminAccess = member.AdminAccess;
            }
        }
    }
}
